<script setup lang="ts">
import { ref } from 'vue'
import { useRoute } from 'vue-router'
import {
 searchmes,
} from '@/services/user'



const route = useRoute()

const list=ref([{"name":'222','content':'AA顶起'},{"name":'11111','content':'222奇才'}])
const currentPage = ref(1);
const totals=ref(10)
const pagesize=ref(2)


const getusermes = async () => {
    const sname = route.query.name
    const res = await searchmes(sname,currentPage.value)
    if(res.code == 200){
      list.value = res.rlist
      totals.value = res.total
   }
}
const onLoad=()=>{
  getusermes()
}

const changepage=(page)=>{
  alert(page)
  currentPage.value = page
  getusermes()

}
</script>

<template>
  <div class="consult-page">
    <cp-nav-bar title="查询结果" />

  <van-list  
  
  finished-text="没有更多了"  
  @load="onLoad"  
>  
  <van-cell v-for="item in list" :key="item.id">  
    <div class="cell-content">  
      <div class="cell-column">{{ item.id }}</div>  
      <div class="cell-column">{{ item.name }}</div>  
      <div class="cell-column">{{ item.descrip }}</div>  
    </div>  
  </van-cell>  
</van-list>  

  <van-pagination v-model="currentPage" :total-items="totals" :items-per-page="pagesize" @change='changepage'/>


  </div>
</template>

<style lang="scss" scoped>
.consult-page {
  padding-top: 46px;}
.cell-content {  
  display: flex;  
  justify-content: space-between;  
  align-items: center;  
  padding: 8px; /* 或者你需要的内边距 */  
}  
  
.cell-column {  
  /* 你可以根据需要调整这些样式 */  
  flex: 1; /* 让每个列占据相同的空间，或者你可以设置具体的宽度 */  
  text-align: center; /* 或者 left, right 根据你的需求 */  
  padding: 0 8px; /* 如果你想在列之间添加一些空间 */  
}  

</style>
